//
//  LZVideoListModel.m
//  laziz_Consumer
//
//  Created by xbnzd on 16/11/19.
//  Copyright © 2016年 XBN. All rights reserved.
//

#import "LZVideoListModel.h"
#import "MJProperty.h"
#import "LZDateFormatterManager.h"

@implementation LZVideoListModel

- (id)mj_newValueFromOldValue:(id)oldValue property:(MJProperty *)property
{
    if ([oldValue isKindOfClass:[NSNull class]])
        return @"";
    
    if ([property.name isEqualToString:@"publishTime"]) {
        
        NSString *publishTime = [[LZDateFormatterManager shareInstance] stringFromStringNormalHaveLineyyyyMMdd:oldValue];
        return publishTime;
    }

    
    return oldValue;
}

+ (NSDictionary *)mj_replacedKeyFromPropertyName{
    return @{
             @"videoId" : @"id"
             };
}


- (CGFloat)starLevel
{
    if (_remarkCountPerson > 0 && _remarkCountScore > 0) {
        CGFloat temp = (CGFloat)_remarkCountScore / (CGFloat)_remarkCountPerson;
        NSString *s = [NSString stringWithFormat:@"%.1f",temp];
        
        return [s floatValue];
    }
    
    return 0;
}

- (NSString *)couponsResidueCount
{
    NSInteger residue = _couponsTotalCount - _couponsGetCount;
    
    return [NSString stringWithFormat:@"%ld",residue];
}

// 将videoid赋给noRemarkid，promotionId赋给videoid
- (void)refreshToBeReviewListModel {
    self.noRemarkId = [self.videoId copy];
    self.videoId = [self.promotionId copy];
}

@end
